package com.delivery.www.servlet;

import com.delivery.www.po.Order;
import com.delivery.www.po.User;
import com.delivery.www.service.ServiceImpl.OrderServiceImpl;

import java.util.List;
import java.util.Scanner;

import static com.delivery.www.servlet.UserPage.userPage;

public class OwnOrder {
    public static void ownOrderPage(User user) {
        OrderServiceImpl orderService = new OrderServiceImpl();
        Scanner scanner = new Scanner(System.in);
        List<Order> orders = orderService.getOwnOrder(user.getUserId());
        for (Order order : orders) {
            System.out.println("===============================");
            System.out.println("订单id:" + order.getOrderId());
            System.out.println("订单菜名:" + order.getDishName());
            System.out.println("店铺名:" + order.getStoreName());
            System.out.println("订单金额:" + order.getMoney());
            System.out.println("订单状态:" + order.getStatus());
            System.out.println("===============================");
        }
        System.out.println("返回请按0");
        int i = scanner.nextInt();
        while (i != 0) {
            System.out.println("输入错误！请重新输入");
            i = scanner.nextInt();
        }
        userPage(user);
    }
}
